<!DOCTYPE html>
<html>
<head>
        <meta charset="utf-8">
        <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
        <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
        <link rel="stylesheet" type="text/css" href="../../css/aui.css">
        <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css">
        <link rel="stylesheet" type="text/css" href="../../css/api.css">
        <link rel="stylesheet" href="../../css/common.css">
        <link rel="stylesheet" type="text/css" href="../../font-icon/demo.css">
        <link rel="stylesheet" type="text/css" href="../../font-icon/iconfont.css">
        <script type="text/javascript" src="../../script/api.js"></script>
        <script type="text/javascript" src="../../script/APICloud-rest.js"></script>
        <script type="text/javascript" src="../../script/APICloud-rest-SHA1.js"></script>
        <script type="text/javascript" src="../../script/SHA1.js"></script>
        <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
</head>

<title></title>
<style>

</style>
</head>
<body style="background-color: #fff;" >
      
                <div id="youquan_tab" >
                                <header id="header" class="aui-bar aui-bar-nav" >
                                                <i class="aui-iconfont aui-icon-left"  style="float:left;margin: 0.5rem;" onclick="api.closeWin()"></i>
                                    <div class="aui-title" id="title_t">0条</div>
                                    
                                </header>
                             
                </div>
                            
                <div style="width: 100%;margin-top: 3rem;float: right;background-color: #fff;">
                                <div id="get_info">
                                        <!-- <div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items:center;margin-left: 0.5rem;    margin-top: 0.5rem;">
                                                <div style="width: 3rem;height: 3rem;border-radius: 100%;background-color: red;float: left;"></div>
                                                <div  style="width:7rem;height: 3rem;background-color: #fff;margin-left: 0.5rem;display: flex;flex-direction: column;">
                                                        <span style="height:1.8rem;line-height: 2rem;font-size: 0.8rem;font-weight: bold; ">方法</span>
                                                        <span style="height:1.7rem ;font-size: 0.8rem;">10:10</span>
                                                </div>
                                                <div style="display: flex;flex-direction: row;flex-wrap: nowrap;background-color: #fff;width: 43%;height: 2rem;align-items:flex-end;justify-content:flex-end;">
                                                <span class="aui-iconfont aui-icon-laud" style="font-size: 1rem;"></span><span style="font-size: 0.7rem;line-height:1.6rem;margin-right: 0.5rem">7</span>  
                                                <span class="aui-iconfont aui-icon-comment" style="font-size: 1rem;margin-right: 0.5rem"></span><span style="font-size: 0.7rem;line-height:1.6rem;margin-right: 0.5rem">7</span> 
                                                
                                                </div>
                                         </div> 


                                        <div style="width: 94%;margin-left: 0.6rem;font-size: 0.8rem;display: flex;flex-direction: row;flex-wrap: wrap;">
                                                sdfdsgsdgdsgsdgsd对方水电费阿达说的阿尔啊放入对方水电费等
                                        
                                        </div>
                
                
                                        <div style="font-size: 0.8rem;margin-left: 0.3rem;border-top: solid 0.05rem #e9e9e9;background-color: transparent">共15条回复</div> -->
                                </div>

                                        <div style="width: 100%;display: flex;flex-direction: column;margin-bottom: 3rem;" id="more_coment">
                                                <!-- <div style="display: flex;flex-direction: column;margin-top: 0.5rem;">
                                                                <div style="display: flex;flex-direction: row;flex-wrap: nowrap;margin-left: 0.5rem;" >
                                                                                <div style="width: 2.5rem;height: 2.5rem;border-radius: 100%;background-color: red;"> </div>
                                                                                <div style="display: flex;flex-direction: column;width: 6rem;height: 100%;width: 11rem;background-color: transparent;margin-left: 0.3rem">
                                                                                        <span style="height: 60%;font-size: 0.75rem;line-height: 1.5rem;color: #018aff;">s解决</span>
                                                                                        <span style="height: 40%;font-size: 0.7rem">s上述</span>
                                                                                </div>
                                                                                <div style="height: 100%;line-height: 1.8rem;">
                                                                                                <span class="aui-iconfont aui-icon-laud" style="height: 60%;font-size: 0.9rem;line-height: 1.5rem;">xx</span>
                                                                                
                                                                                </div>
                                                                </div>
                                                                <div  style="display: flex;flex-direction: row;margin-left: 0.5rem;align-items: flex-end;">
                                                                        <div style="background-color: transparent;width: 61%;display: flex;flex-direction: row;flex-wrap: wrap;color: #999999;margin-left: 2.8rem;word-break: break-all;">
                                                                                <div >sssssssssssssssssssssssssssssssssssssssssssssssss</div>
                                                                        </div>
                                                                        <div style="text-align: right;width: 3.2rem;background-color: transparent;">
                                                                                回复
                                                                        </div>

                                                                </div>
                                                                <div style="width: 78%;height: 0.05rem;background-color: #e9e9e9;;margin-left: 18%;"> </div>
                                                </div> -->

                      


                                        </div>
                       


                       
                </div>

                <div style="width: 100%;height: 3rem;background-color: #fff;position: fixed;bottom: 0rem;display: flex;flex-direction: row;flex-wrap: nowrap;">
                        <input style="width: 76% ;height: 2rem;border: solid 0.08rem #e9e9e9;border-radius: 0.5rem;margin-left: 1rem;margin-top: 0.5rem;" class="huifu_coment_val"/><div style="font-size: 0.9rem;line-height: 3rem;margin-left: 0.5rem;" onclick="huifu_coment_v()">评论</div>
                </div>
                            
             

        

</body>
<script  type="text/javascript">
 apiready = function() {

                                var new_id =  $api.getStorage('new_id');
                                var token = $api.getStorage('token');
                                
                                var id_dongtai_xq = $api.getStorage('id_dongtai_xq_zh');
                                
                                var token = {
                                                token: token,
                                                categry:'comment',
                                                dtid:id_dongtai_xq
                                        };
                                        api.ajax({
                                        url: 'http://www.mk517.com/webApi/youquans.php',
                                        method: 'post',
                                        "headers": {
                                                "Content-Type": "application/json"
                                        },
                                        dataType: "json",
                                        data: {
                                                body: token
                                        }
                                        }, function(ret, err) {
                                        // alert(JSON.stringify(ret));
                                        if (ret) {
                                                for(var i=0;i<ret.length;i++){
                                                        if(ret[i]['id']==new_id){
                                                                if(ret[i]['reply']==''||ret[i]['reply']==null){
                                                                        var length=0;
                                                                        
                                                                }else{
                                                                        var length=ret[i]['reply'].length;
                                                                }
                                                              
                                                                if(ret[i]['is_zan']==1){
                                                                        var zan = ' <span class="aui-iconfont aui-icon-laud dianzan" style="font-size: 1rem;color:#f84d1f;"></span><span style="font-size: 0.7rem;line-height:1.6rem;margin-right: 0.5rem">'+ret[i]['zan']+'</span> ';
                                                                        $api.setStorage('dianzan_shu',1);
                                                                      

                                                                }else if(ret[i]['is_zan']==0){
                                                                        var zan = ' <span class="aui-iconfont aui-icon-laud dianzan" style="font-size: 1rem;"></span><span style="font-size: 0.7rem;line-height:1.6rem;margin-right: 0.5rem">'+ret[i]['zan']+'</span> ';
                                                                        $api.setStorage('dianzan_shu',2);
                                                                }

                                                                   $api.byId('get_info').innerHTML= '<div style="display: flex;flex-direction: row;flex-wrap: nowrap;align-items:center;margin-left: 0.5rem;    margin-top: 0.5rem;">'+
                                                                                                ' <div style="width: 3rem;height: 3rem;border-radius: 100%;background-color: red;float: left;"><img style="height:100%;width:100%;" src="'+ret[i]['head_img']+'"></div>'+
                                                                                                ' <div  style="width:7rem;height: 3rem;background-color: #fff;margin-left: 0.5rem;display: flex;flex-direction: column;">'+
                                                                                                        '  <span style="height:1.8rem;line-height: 2rem;font-size: 0.8rem;font-weight: bold; ">'+ret[i]['name']+'</span>'+
                                                                                                        ' <span style="height:1.7rem ;font-size: 0.8rem;">'+ret[i]['time']+'</span>'+
                                                                                                        '</div>'+
                                                                                                ' <div style="display: flex;flex-direction: row;flex-wrap: nowrap;background-color: #fff;width: 43%;height: 2rem;align-items:flex-end;justify-content:flex-end;">'+
                                                                                                zan +
                                                                                                        '<span class="aui-iconfont aui-icon-comment" style="font-size: 1rem;margin-right: 0.5rem"></span><span style="font-size: 0.7rem;line-height:1.6rem;margin-right: 0.5rem">'+ret[i]['reply_count']+'</span> '+
                                                                                                        
                                                                                                ' </div>'+
                                                                                                '</div>' +


                                                                                                '<div style="width: 94%;margin-left: 0.6rem;font-size: 0.8rem;display: flex;flex-direction: row;flex-wrap: wrap;margin-top:1rem;">'+
                                                                                                       
                                                                                                                ret[i]['content']+
                                                                                                '</div>'+
                                                                        
                                                                        
                                                                                                '<div style="font-size: 0.8rem;margin-left: 0.5rem;border-top: solid 0.05rem #e9e9e9;background-color: transparent">共'+length+'条回复</div>';
                                                                                                        $api.byId('title_t').innerHTML=length+'条';
                                                                                                if(ret[i]['reply']){
                                                                                                     
                                                                        for(var j=0;j <  ret[i]['reply'].length;j++){
                                                                        $api.byId('more_coment').innerHTML +=       
                                                                            '<div style="display: flex;flex-direction: column;margin-top: 0.5rem;">'+
                                                                                                '<div style="display: flex;flex-direction: row;flex-wrap: nowrap;margin-left: 0.5rem;" >'+
                                                                                                                '<div style="width: 2.5rem;height: 2.5rem;border-radius: 100%;background-color: red;"><img  src="'+ret[i]['head_img']+'"/> </div>'+
                                                                                                               ' <div style="display: flex;flex-direction: column;width: 6rem;height: 100%;width: 11rem;background-color: transparent;margin-left: 0.3rem;">'+
                                                                                                                        '<span style="height: 60%;font-size: 0.75rem;line-height: 1.5rem;color: #018aff;">'+ret[i]['reply'][j]['name']+'<span style="color:#999999;"> 回复</span>'+ret[i]['reply'][j]['toname']+'</span>'+
                                                                                                                        '<span style="height: 40%;font-size: 0.7rem">'+ret[i]['reply'][j]['time']+'</span>'+
                                                                                                               ' </div>'+
                                                                                                                '<div style="height: 100%;line-height: 1.8rem;display: flex;flex-direction: column;">'+
                                                                                                                               ' <span class="aui-iconfont aui-icon-laud" style="height: 60%;font-size: 0.9rem;line-height: 1.5rem;">'+ret[i]['reply'][j]['zan']+'</span>'+
                                                                                                                               '<input type="hidden" value="ssss">'+
                                                                                                                               '<span style="text-align: left;width: 3.2rem;background-color: transparent;color:#018aff" class="huifu_more">回复</span>'+
                                                                                                                               '<input type="hidden" value="'+ret[i]['reply'][j]['name']+'">'+
                                                                                                                               
                                                                                                                
                                                                                                                '</div>'+
                                                                                               ' </div>'+
                                                                                                '<div  style="display: flex;flex-direction: row;margin-left: 0.5rem;align-items: flex-end;">'+
                                                                                                       ' <div style="background-color: transparent;width: 61%;display: flex;flex-direction: row;flex-wrap: wrap;color: #999999;margin-left: 2.8rem;word-break: break-all;">'+
                                                                                                                '<div >'+ret[i]['reply'][j]['content']+'</div>'+
                                                                                                       ' </div>'+
                                                                                                        '<div style="text-align: right;width: 3.2rem;background-color: transparent;">'+
                                                                                                                
                                                                                                        '</div>'+

                                                                                                '</div>'+
                                                                                                '<div style="width: 78%;height: 0.05rem;background-color: #e9e9e9;;margin-left: 18%;"> </div>'+
                                                                                '</div>'; 
                                                                        
                                                                        }
                                                                

                                                                                        }     

                                                        }
                                                }
                                                
                                        }else {
                                                alert(JSON.stringify(err));
                                        }
                                        });






//回复功能
                        window.huifu_coment_v = function huifu_coment_v() {
                                var new_id =  $api.getStorage('new_id');
                                       var value_new=$('.huifu_coment_val').val();
                                    var to_id_id= $api.getStorage('id_dongtai_xq_zh');
                                     if( value_new=='' ){
                                       alert('请输入内容再评论!');
                                     }else{
                                        
                                       var token = $api.getStorage('token');
                               var cc=$('.zhuanfa_share').next('input').val();


                                       var token = {
                                               token: token,
                                               to:to_id_id,//一级动态
                                               do:'comment' ,
                                               content: value_new,
                                               reply:new_id//评论的id
                                       };
                                       api.ajax({
                                       url: 'http://www.mk517.com/webApi/youquan_do.php',
                                       method: 'post',
                                       "headers": {
                                               "Content-Type": "application/json"
                                       },
                                       dataType: "json",
                                       data: {
                                               body: token
                                       }
                                       }, function(ret, err) {
                                       // alert(JSON.stringify(ret));
                                       if (ret) {
                                           if( ret.sta==1){
                                                   alert('发表成功！');
                                                   window.location.reload();
                                           }else if(ret.sta==0){
                                                        alert('发表失败!');
                                                }else if(ret.sta==2){
                                                        alert('不能能回复自己!');
                                                }
                                               
                                       }else {
                                               alert(JSON.stringify(err));
                                       }
                                       });
                                     }
                                       
                               }



                               //回复更多

         $('body').on('click','.huifu_more',function(){
                 var name=$(this).next('input').val();
                 alert('请在输入框输入对'+name+'的回复');
                 var new_id_reply=$(this).prev('input').last().val();
                 $api.setStorage('new_id',new_id_reply);
         });
        //点赞
         $('body').on('click','.dianzan',function(){
                 
               var som_dianzan= $api.getStorage('dianzan_shu');
                 
                 if(som_dianzan%2==0){//没有
              
                        var  do_zan='comment_zan';
                 }else if(som_dianzan%2==1){//赞了
                      var  do_zan='comment_zan_del';

                       
                 }
                var token = $api.getStorage('token');
                               var cc=$('.zhuanfa_share').next('input').val();


                                       var token = {
                                               token: token,
                                               to:new_id,//dangqian
                                               do:do_zan 
                                              
                                       };
                                       api.ajax({
                                       url: 'http://www.mk517.com/webApi/youquan_do.php',
                                       method: 'post',
                                       "headers": {
                                               "Content-Type": "application/json"
                                       },
                                       dataType: "json",
                                       data: {
                                               body: token
                                       }
                                       }, function(ret, err) {
                                       // alert(JSON.stringify(ret));
                                       if (ret) {
                                          if(ret.sta==1){
                                                  alert('操作成功!');
                                                  window.location.reload();
                                                 
                                          }else if(ret.sta==0){
                                                alert('操作失败!');
                                          }
                                               
                                       }else {
                                               alert(JSON.stringify(err));
                                       }
                                       });
         });


 }

</script>
</html>